{% extends "common/base.html" %}
{% block content %}
    <div class="row-content am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title  am-cf">用户修改</div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        {% if user %}
                            <form action="/users/change/{{ user.id }}/" class="am-form am-form-horizontal" method="post"
                                  data-am-validator>{% csrf_token %}
                                <fieldset>
                                    <div class="am-form-group">
                                        <label for="username">账户：</label>
                                        <input type="text" id="username" name="username" minlength="3"
                                               value="{{ user.username }}" required/>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="password">密码：</label>
                                        <input type="password" id="password" name="password" minlength="8" value="{{ user.password }}" required/>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="last_name">姓：</label>
                                        <input type="text" id="last_name" name="last_name" value="{{ user.first_name }}"
                                               required/>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="first_name">名：</label>
                                        <input type="text" id="first_name" name="first_name" value="{{ user.last_name }}"
                                               required/>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="email">邮箱：</label>
                                        <input type="email" id="email" name="email" value="{{ user.email }}" required/>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="phone">电话：</label>
                                        <input type="text" id="phone" name="phone" value="{{ user.userprofile.phone }}"
                                               />
                                    </div>

                                    <div class="am-form-group">
                                        <label for="qqnum">QQ：</label>
                                        <input type="text" id="qqnum" name="qqnum" value="{{ user.userprofile.qqnum }}"
                                               />
                                    </div>

                                    <div class="am-form-group">
                                        <label for="weixin">微信：</label>
                                        <input type="text" id="weixin" name="weixin" value="{{ user.userprofile.weixin }}"
                                               />
                                    </div>

                                </fieldset>
                                <div class="am-modal-footer">
                                    <button class="am-btn am-btn-secondary" type="submit">提交</button>
                                </div>
                            </form>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}